package com.jinlejia.bbs.lab;

import android.content.Context;
import android.content.Intent;

import com.jinlejia.bbs.bean.base.TopicBean;
import com.jinlejia.bbs.ui.gambit.BBSCommentsByAnswerActivity;
import com.jinlejia.bbs.ui.message.BBSInviteListActivity;
import com.jinlejia.bbs.ui.mine.BBSMyFansActivity;
import com.jinlejia.bbs.ui.reply.BBSReplyDetailActivity;
import com.lab.push.BBSPushProtocol;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class BBSPushMessageProtocol implements BBSPushProtocol {
    @Override
    public void sendBBSPush(@NotNull Context context, @Nullable String code, @Nullable String url) {
        Intent jumpIntent = new Intent();
        if ("attention".equals(url)){ //跳转 粉丝列表页
            jumpIntent.setClass(context, BBSMyFansActivity.class);
            context.startActivity(jumpIntent);
        }else if ("topic_detail".equals(url)){ //跳转  话题详情
            jumpIntent.setClass(context, BBSReplyDetailActivity.class);
            TopicBean topic = new TopicBean();
            topic.setTopicCode(code);
            jumpIntent.putExtra("topic",topic);
            context.startActivity(jumpIntent);
        }else if ("comments_table".equals(url)){ //跳转  评论
            jumpIntent.setClass(context, BBSCommentsByAnswerActivity.class);
            jumpIntent.putExtra("answerCode",code);
            context.startActivity(jumpIntent);
        }else if ("inviterecord_table".equals(url)){ //跳转  邀请回答
            jumpIntent.setClass(context, BBSInviteListActivity.class);
            context.startActivity(jumpIntent);
        }
    }
}
